module Debounce(input[7:0] Btn_In, input CLK, input CLK_n, output reg[7:0] Out );
reg[7:0] Delay0,Delay1,Delay2,mood;
always @(negedge CLK, negedge CLK_n)
begin
if(!CLK_n) begin Delay0<=8'b0; Delay1<=8'b0; Delay2<=8'b0; end
else begin //向右移位
Delay0<=Btn_In;
Delay1<=Delay0;
Delay2<=Delay1;
end
 assign mood= Delay0 & Delay1 &~Delay2;
 
end
always @(mood) 
begin
   if (mood) 
   begin
    Out=mood;
   end
end
endmodule

